const express = require('express');
const app = require('express');
const router = app.Router();
module.exports = router;

/**
 * 登陆响应
 * http://localhost:9588/login/?phone=12345678901&code=1234
 */
router.post('/', (req, res) => {
    const {phone, code} = req.query;
    //查询是否能够匹配用户名密码保持一直的字段
    console.log(req.query)
    console.log(phone)
    console.log(code)
    if (code == "1234") {
        return res.json({
            code: 200,
            msg: '登陆成功',
            data: {token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjpbeyJ0b29sdHQiOiJodHRwczovL3Rvb2x0dC5jb20ifV0sImlhdCI6MTY4MTgwMTcxOSwiZXhwIjoxOTA2MzAwNzk5LCJhdWQiOiIiLCJpc3MiOiJ3cmVyIiwic3ViIjoiIn0.aOkvLZ5YOzFwaQnhWDDN2ESqvU8Y6l89o52ul3T7qVg'}
        })
    } else {
        return res.json({code: 10000, msg: '用户手机号码或验证码错误'})
    }
})